import 'package:hm_show_flutter/entity/subscribe_list_entity.dart';

subscribeListEntityFromJson(SubscribeListEntity data, Map<String, dynamic> json) {
	if (json['errno'] != null) {
		data.errno = json['errno']?.toInt();
	}
	if (json['data'] != null) {
		data.data = new SubscribeListData().fromJson(json['data']);
	}
	if (json['errmsg'] != null) {
		data.errmsg = json['errmsg']?.toString();
	}
	return data;
}

Map<String, dynamic> subscribeListEntityToJson(SubscribeListEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['errno'] = entity.errno;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	data['errmsg'] = entity.errmsg;
	return data;
}

subscribeListDataFromJson(SubscribeListData data, Map<String, dynamic> json) {
	if (json['notifys'] != null) {
		data.notifys = new List<SubscribeListDataNotify>();
		(json['notifys'] as List).forEach((v) {
			data.notifys.add(new SubscribeListDataNotify().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> subscribeListDataToJson(SubscribeListData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	if (entity.notifys != null) {
		data['notifys'] =  entity.notifys.map((v) => v.toJson()).toList();
	}
	return data;
}

subscribeListDataNotifyFromJson(SubscribeListDataNotify data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['startTime'] != null) {
		data.startTime = json['startTime']?.toString();
	}
	if (json['endTime'] != null) {
		data.endTime = json['endTime']?.toString();
	}
	if (json['description'] != null) {
		data.description = json['description']?.toString();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['mobile'] != null) {
		data.mobile = json['mobile']?.toString();
	}
	if (json['product'] != null) {
		data.product = new SubscribeListDataNotifysProduct().fromJson(json['product']);
	}
	return data;
}

Map<String, dynamic> subscribeListDataNotifyToJson(SubscribeListDataNotify entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['startTime'] = entity.startTime;
	data['endTime'] = entity.endTime;
	data['description'] = entity.description;
	data['name'] = entity.name;
	data['mobile'] = entity.mobile;
	if (entity.product != null) {
		data['product'] = entity.product.toJson();
	}
	return data;
}

subscribeListDataNotifysProductFromJson(SubscribeListDataNotifysProduct data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['url'] != null) {
		data.url = json['url']?.toString();
	}
	return data;
}

Map<String, dynamic> subscribeListDataNotifysProductToJson(SubscribeListDataNotifysProduct entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['url'] = entity.url;
	return data;
}